import { _decorator, Component, Node, ToggleContainer, Toggle, CCInteger } from 'cc';
import { MyEvent } from './event/MyEvent';
const { ccclass, property } = _decorator;

@ccclass('MultiViewComp')
export class MultiViewComp extends Component {

    @property(CCInteger)
    viewId: number = 0

    @property(Node)
    content: Node = null

    @property(ToggleContainer)
    toggles: ToggleContainer = null

    start() {

    }

    update(deltaTime: number) {

    }

    onToggle(t: Toggle): void {
        const index = this.toggles.node.children.indexOf(t.node);
        const e = new MyEvent("node_switchPage", true, index)
        this.node.dispatchEvent(e)
    }
}

